// index.js
const {
  SelTabbar,
  ShowTabbar
} = require('../../utils/tab-bar-sel.js')
const app = getApp()
Page({
  data: {
    statusBarHeight: app.globalData.statusBarHeight,
    img_List: [{
      url: 'https://bing.com/th?id=OHR.OliveOrchard_ZH-CN8198989130_1920x1080.jpg'
    }, {
      url: 'https://bing.com/th?id=OHR.MallarDucks_ZH-CN7422818269_1920x1080.jpg'
    }, {
      url: 'https://bing.com/th?id=OHR.NorwayBirch_ZH-CN5482311438_1920x1080.jpg'
    }],
    img2_List: [{
      url: 'https://bing.com/th?id=OHR.MallarDucks_ZH-CN7422818269_1920x1080.jpg'
    }, {
      url: 'https://bing.com/th?id=OHR.NorwayBirch_ZH-CN5482311438_1920x1080.jpg'
    }],
    img1_List: [{
      url: 'https://bing.com/th?id=OHR.NorwayBirch_ZH-CN5482311438_1920x1080.jpg'
    }],
    show: true
  },
  scrollTop: 0,
  isShowTabbar: true,
  onShow(options) {
    SelTabbar(this, 0)
  },
  onPageScroll(e) {
    if (e.scrollTop < 0) return
    if (e.scrollTop - this.scrollTop > 5) {
      if (this.isShowTabbar) {
        ShowTabbar(this, false)
        this.isShowTabbar = false
      }
    } else if (e.scrollTop - this.scrollTop < -10) {
      if (!this.isShowTabbar) {
        ShowTabbar(this, true)
        this.isShowTabbar = true
      }
    }
    this.scrollTop = e.scrollTop
  },
})